package com.neiquan.backstage.platform_weixin.handler;

import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import me.chanjar.weixin.common.exception.WxErrorException;
import me.chanjar.weixin.common.session.WxSessionManager;
import me.chanjar.weixin.mp.api.WxMpMessageHandler;
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.bean.WxMpXmlMessage;
import me.chanjar.weixin.mp.bean.WxMpXmlOutMessage;

public class SubscribeHandler implements WxMpMessageHandler {
	private static final Logger log = LoggerFactory.getLogger(SubscribeHandler.class);

	@Override
	public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage, Map<String, Object> context, WxMpService wxMpService,
			WxSessionManager sessionManager) throws WxErrorException {
		log.info("handle, fromUser={}", wxMessage.getFromUserName());
		return WxMpXmlOutMessage.TEXT().content("欢迎关注").fromUser(wxMessage.getToUserName())
				.toUser(wxMessage.getFromUserName()).build();
	}
}
